<script setup lang="ts">
import { Cell } from '@antv/x6'
import { ImagePicker } from '@yk/components/draw/shapes/components/image-picker'
import { ObjectUtil } from '@utils/object-util'

const props = defineProps<{
  cell: Cell | any
}>()

let _cell = toRaw(props.cell)

watch(() => props.cell, () => {
  _cell = toRaw(props.cell)
  init()
})

onMounted(() => {
  init()
})

function init () {
  saveForm.value = ObjectUtil.copy(props.cell.data.dataConfig.dataOption)
}

// region TODO 表单
const saveForm = ref<any>({})
// endregion

// region TODO 网关分布
function alarmStatisticsSubmit () {
  _cell.data.dataConfig.dataOption = saveForm.value
  ElMessage.success('已绑定')
}
// endregion

</script>

<template>
  <el-collapse-item title="数据类型" name="DataType">
    <el-form-item label="展示数据">
      <el-select v-model="saveForm.dataType">
        <el-option value="gatewayDistribution" label="网关分布" />
      </el-select>
    </el-form-item>
    <el-form-item>
      <el-button type="primary" class="mt-2" @click="alarmStatisticsSubmit">确定</el-button>
    </el-form-item>
  </el-collapse-item>
</template>

<style scoped lang="scss">
</style>
